package com.ruoyi.demo.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.demo.domain.UserPhoto;
import com.ruoyi.demo.service.IUserPhotoService;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 用户照片Controller
 */
@RestController
@RequestMapping("/demo/userPhoto")
public class UserPhotoController extends BaseController {
    @Autowired
    private IUserPhotoService userPhotoService;

    /**
     * 查询用户照片列表
     */
    @PreAuthorize("@ss.hasPermi('demo:userPhoto:list')")
    @GetMapping("/list")
    public TableDataInfo list(UserPhoto userPhoto) {
        startPage();
        List<UserPhoto> list = userPhotoService.selectUserPhotoList(userPhoto);
        return getDataTable(list);
    }

    /**
     * 删除用户照片
     */
    @PreAuthorize("@ss.hasPermi('demo:userPhoto:remove')")
    @Log(title = "用户照片", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(userPhotoService.deleteUserPhotoByIds(ids));
    }
}
